<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Siku在线考试系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__ROOT__/public/static/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="__ROOT__/public/static/css/my.css">
 <style type="text/css">
html{height: 100%;}
body{height: 100%;min-height: 500px;margin: 0; background-color: #009688;background-image: url(__ROOT__/public/static/img/bg.jpg);}
</style>
</head>
<body>
<div class="loginbox"style="padding: 20px;box-shadow: 0 3px 2px 0 rgba(255,255,255,0.2);background-color:rgba(0,0,0,0.2);padding-bottom: 25px;">
	<form class="layui-form">
		<!--<h1>Tingke后台管理系统</h1>--->
      <h1><b><font color="#ffffff">Siku（思酷）在线考试系统</font> </b></h1>
		<li><span>账户：</span><input name="username" type="text" required  lay-verify="required" /></li>
		<li><span>密码：</span><input name="password" type="password" required lay-verify="required"/></li>
		<li><button class="s layui-btn layui-btn-fluid" lay-submit lay-filter="formdata" style="margin-top: 10px;" />登陆系统</button></li>
	</form>
</div>
<script src="__ROOT__/public/static/layui/layui.js"></script>
<script>
//Demo
layui.use(['form','jquery'], function(){
  var form = layui.form,$ = layui.jquery;
  
  //监听提交
  form.on('submit(formdata)', function(data){
   // layer.msg(JSON.stringify(data.field));
    $.post("<{:url('login')}>",data.field,function(data,status){
          //alert(data);
          //alert(JSON.stringify(data));
          //console.log(data);
          if(data===1){
            //layer.close(index);
            layer.msg('登录成功！',{time:1000},function(){
              location.href="<{:url('index/index')}>";
            }); 
          }else{
            //layer.close(index);
            layer.alert('登录失败，请检查账号重试！',{icon:5});
          }
    })
    return false;
  });
});
</script>
</body>
</html>